const express = require('express')

const router = express.Router()

const userinfo_handler = require('../router_handler/userinfo')

const expressJoi = require('@escook/express-joi')

// 获取用户新的路由
router.get('/userinfo',userinfo_handler.getUserInfo)

// 更新用户信息的路由(之前先进行前端验证)
const {update_user_schema,update_password_schema,update_avatar_schema} = require('../schema/user')
router.post('/userinfo',expressJoi(update_user_schema),userinfo_handler.updateUserInfo)

// 更新密码的路由(之前先进行前端验证)
router.post('/updatepwd',expressJoi(update_password_schema),userinfo_handler.updatePassword)

// 更新头像的路由
router.post('/update/avatar',expressJoi(update_avatar_schema),userinfo_handler.updateAvatar)

module.exports = router